.page {
  &.v2 {
    .container {
      padding: 0;

      @media screen and (max-width: 1600px) {
        width: 99%;
      }

      @media screen and (max-width: 1100px) {
        padding: 8px;
      }
    }

    .page-header {
      margin-top: 55px;
      padding-top: 40px;
      padding-bottom: 32px;

      nav.docs-navigation {
        padding-left: 8px;
        padding-right: 8px;

        @media (max-width: 1100px) {
          padding: 8px 8px 0;
        }
      }

      .title-version-search-container {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
      }

      .page-header-title {
        margin: 0;
        max-width: none;
        display: block;
        text-align: center;

        h1 {
          font-size: 40px;
          color: #062e4d;
          font-weight: lighter;
        }

        h2 {
          max-width: 800px;
          margin-top: 16px;
          font-size: 16px;
          font-weight: lighter;
          opacity: 0.6;
        }
      }

      @media (max-width: 1100px) {
        padding-top: 24px;
      }
    }

    .page-content-container {
      padding-left: 285px;

      .page-content {
        padding-left: 75px;

        .welcome-text {
          margin-bottom: 32px;
          font-size: 16px;
        }
      }

      @media (max-width: 800px) {
        padding-left: 0;
        padding-right: 0;

        .page-content {
          border-left: none;
        }
      }
    }

    &:not(.homepage) {
      .page-header {
        background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0), #effeff);
        padding-bottom: 12px;

        .container {
          max-width: none;

          .docs-navigation {
            max-width: 1200px;
            margin: 0 auto 32px;
          }
        }

        .page-header-title {
          margin-bottom: 16px;
          text-align: left;
        }

        .title-version-search-container {
          justify-content: space-between;
          padding-left: 360px;
          padding-right: 360px;
        }

        .search-version-row {
          margin-top: 0;
          margin-bottom: 16px;
        }

        @media screen and (max-width: 1080px) {
          .title-version-search-container {
            padding-left: 316px;
            padding-right: 316px;
          }
        }

        @media screen and (max-width: 800px) {
          .title-version-search-container {
            justify-content: center;
            margin-top: 50px;
            padding-left: 32px;
            padding-right: 32px;

            .page-header-title {
              text-align: center;
            }
          }
        }
      }

      .page-content-container {
        padding-right: 300px;

        .page-content {
          padding-left: 75px;
          padding-right: 75px;
        }

        @media screen and (max-width: 1080px) {
          padding-right: 0;

          .page-content {
            padding: 0 32px;

            .content {
              padding-top: 32px;
            }
          }
        }
      }

      > .container {
        max-width: none;
      }
    }

    &.homepage {
      .title-version-search-container {
        flex-direction: column;
      }

      .page-content {
        padding-left: 32px;
        padding-right: 32px;

        .content {
          padding-top: 32px;
        }
      }
    }
  }

  &:not(.v2) {
    .page-content-container {
      padding-right: 230px;

      .page-content {
        padding-right: 50px;
        border-right: 1px solid @gray;
        margin-right: 25px;
      }

      @media (max-width: 800px) {
        padding-left: 0;
        padding-right: 0;

        .page-content {
          padding: 0;
          border-right: none;
          border-left: none;
          margin-right: 0;
          margin-left: 0;
        }
      }
    }
  }
}

.page-header {
  position: relative;
  background-color: #fdfdfd;
  border-bottom: 1px solid @gray;
  padding: 95px 0 20px;

  @media (max-width: 1100px) {
    padding: 50px 0 10px;
  }

  // Needs to be above page-content header margins
  .container {
    z-index: 5;
  }

  @media (max-width: 800px) {
    padding: 25px 0;
  }

  h1, p, .page-header-section-title {
    margin: 0;
  }

  .page-header-icon {
    width: 64px;
    vertical-align: middle;
    display: inline-block;
    margin: 8px 15px 0;

    @media (max-width: 800px) {
      margin-right: 20px;
    }

    img {
      max-width: 100%;
      height: auto;
      display: block;
    }

    @media (max-width: 800px) {
      width: 48px;
    }
  }

  .page-header-title {
    display: inline-block;
    vertical-align: middle;
    margin-right: 20px;
    max-width: calc(~"100% - 460px");

    @media screen and (max-width: 1080px) {
      max-width: 100%;
    }
  }

  .page-header-btn {
    &#version-dropdown {
      width: 220px;
      float: right;
      @media screen and (max-width: 476px) {
        float: left;
      }
    }

    &#searchBar {
      width: 220px;
    }
    &:extend(.button all);
    border-color: #d4d7d9;
    background-image: linear-gradient(to top, #f7f9fa, #fcfcfc);
    color: @gray-dark;
    font-size: 14px;
    line-height: 39px;
    height: 40px;

    &:active {
      background: #f7f9fa;
    }

    em {
      font-style: normal;
      color: #aab0b2;
    }
  }

  .page-header-btn-repo {
    &:before {
      content: "";
      display: inline-block;
      width: 19px;
      height: 22px;
      background: url(/assets/images/logos/logo-github.svg) no-repeat;
      background-size: contain;
      margin-right: 5px;
      vertical-align: middle;
    }
  }

  .page-header-right {
    position: absolute;
    right: 0;
    top: 75%;
    margin-top: 0px;
    min-width: 220px;

    @media (max-width: 1080px) {
      position: static;
      margin-top: 20px;
      display: inline-block;
      vertical-align: bottom;
    }

    &#searchBar {
      top: 50%;
    }
  }

  .dropdown .dropdown-menu {
    @media (max-width: 476px) {
      right: auto;
      float: left;
      top: 90%;
    }
  }

  .page-header-bg {
    position: absolute;
    left: 50%;
    width: 100%;
    top: 0;
    bottom: 0;
    min-width: 1500px;
    transform: translateX(-50%);

    .page-header-bg-image-left,
    .page-header-bg-image-right {
      position: absolute;
      top: 0;
      height: 90%;
    }

    .page-header-bg-image-left {
      left: 0;
    }

    .page-header-bg-image-right {
      right: 0;
    }

    @media (max-width: 1100px) {
      display: none;
    }
  }
}

.sidebar-toggle {
  display: none;
  margin-left: auto;
  font-size: 14px;
  cursor: pointer;

  @media (max-width: 800px) {
    display: flex;
  }
}

.page-navigation {
  float: right;
  width: 215px;
  padding: 50px 0 0 20px;

  .close-sidebar {
    display: none;
    position: fixed;
    top: 1rem;
    right: 25px;
    width: 30px;
    height: 30px;
    overflow: hidden;

    &:before,
    &:after {
      content: '';
      position: absolute;
      height: 4px;
      width: 100%;
      top: 50%;
      left: 0;
      margin-top: -2px;
      border-radius: 5px;
      background: #000;
    }

    &:before {
      transform: rotate(45deg);
    }

    &:after {
      transform: rotate(-45deg);
    }
  }

  @media (max-width: 800px) {
    position: fixed;
    top: 56px;
    right: 0;
    padding: 25px;
    height: ~"calc(100% - 80px)";
    box-shadow: 0px 12px 15px rgba(0, 0, 0, .15);
    border: 0 none;
    background: #fff;
    overflow: scroll;
    z-index: 100;
    transform: translateX(100%);
    -webkit-transform: translateX(100%);
    transition: all 300ms ease-in-out;

    .close-sidebar {
      display: block;
      z-index: 100;
    }

    &.sidebar-open {
      transform: translateX(0);
    }

    nav {
      h5, a {
        font-size: 15px;
      }
    }
  }

  h5 {
    .font-source-sans-sc();
    font-size: 14px;
    color: @gray-darker;
    margin-bottom: 8px;
    line-height: 1.6;
  }

  nav {
    margin-bottom: 1.5em;
  }

  li {
    line-height: 26px;
  }

  li ul {
    padding-left: 15px;

    a {
      color: #85898c;
    }
  }

  li a.active {
    color: @blue;
  }

  a {
    font-size: 14px;
  }

  .fa {
    color: #acb7bf;
  }
}

.toggles {
  display: flex;
  position: sticky;
  top: 60px;
  justify-content: space-between;
  height: 0;
  overflow: hidden;

  .sidebar-toggle {
    display: block;
    visibility: hidden;
    margin-left: 0;
  }

  i {
    padding: 8px;
    color: rgba(0, 0, 0, 0.35);
    font-size: 22px;
  }

  @media screen and (max-width: 1080px) {
    height: auto;
  }

  @media screen and (max-width: 800px) {
    .sidebar-toggle {
      visibility: visible;
    }
  }
}

.docs-navigation {
  position: relative;

  .toggles {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 16px;
  }
}

.page-content-container {
  .page-content {
    .reading-time {
      font-style: italic;
      display: block;
      color: rgb(133, 137, 140);
      margin-bottom: 14px;
    }

    @media (max-width: 800px) {
      padding: 0;
      border-right: none;
      border-left: none;
      margin-right: 0;
      margin-left: 0;
    }
  }

  @media (max-width: 800px) {
    padding-right: 0;
    padding-left: 0;
  }

  &:not(.v2) {
    .toggles {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
    }
  }
}

.content {
  padding: 50px 0;
  .font-source-sans();
  font-size: 16px;
  line-height: 1.5;

  .big {
    font-size: 23px;
  }

  .help {
    img {
      vertical-align: middle;
      display: inline-block;
      margin-right: 10px;
    }
  }

  p, h1, h2, h3, h4, h5, h6 {
    .font-source-sans();
    color: #505659;
  }

  h1, h2, h3, h4 {
    margin-bottom: 1em;
    font-weight: 600;
  }

  h2, h3 {
    font-weight: 600;
    color: #262e33;
  }

  h1 {
    font-size: 34px;
    color: #262e33;
    margin-top: 2em;
    margin-bottom: .9em;
  }

  .alert + h1 {
    margin-top: 1em;
  }

  h2 {
    font-size: 30px;
    margin-top: 2em;
    margin-bottom: .8em;
  }

  h3 {
    margin-top: 1.5em;
    margin-bottom: .7em;
  }

  h4 {
    margin-top: 1.3em;
    margin-bottom: .7em;
  }

  h5 {
    margin-top: 1.2em;
    margin-bottom: .8em;
  }

  > h1:first-child,
  > h2:first-child,
  > h3:first-child {
    margin-top: 0;
  }

  ol {
    &:extend(.instructions-steps);
    padding-left: 19px;

    li {
      &:extend(.instructions-steps .instructions-step-item all);
      padding: 7px 0 15px 35px;

      &:last-child {
        padding-bottom: 15px;
      }

      &:before {
        color: @font-color;
        font-size: 13px;
        width: 36px;
        height: 36px;
        line-height: 36px;
        left: -19px;
      }
    }
  }

  p, figure {
    margin-bottom: 1em;
  }

  a {
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  hr {
    border-top: 2px solid @gray;
    margin-top: 4em;
    margin-bottom: 4em;
  }

  img {
    display: block;
    max-width: 100%;
    height: auto;
  }

  figcaption {
    border: 1px solid #efefef;
    border-radius: 0 0 3px 3px;
    background-color: #fcfcfc;
    .font-source-sans();
    font-size: 14px;
    padding: 14px 13px;
    line-height: 1;
    color: #879199;
  }

  pre {
    background-color: @gray-light;
    border: 1px solid @gray;
    color: #000;
    line-height: 24px;
    margin: 1.3em 0;
    padding: 12px 17px;
    border-radius: 4px;

    code {
      padding: 0;
      color: #000;
      background: transparent;
    }

    &:hover {
      overflow: auto;
    }
  }

  blockquote {
    opacity: 0.8;
    margin-left: 0;
    font-style: italic;
  }

  /*
Generic Styling for Desktop
*/

  table {
    display: block;
    max-width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    overflow-x: auto;

    code {
      white-space: normal;
    }
  }

  code {
    font-size: 14px;
  }

  /* Zebra striping */

  tr:nth-of-type(odd) {
    background: @gray-light;
  }

  th {
    font-weight: bold;
  }

  td, th {
    padding: 6px;
    border: 1px solid #ccc;
  }

  @media only screen and (max-width: 1099px) {
    table, thead, tbody, th, td, tr {
      display: block;
      text-align: left;
    }

    table {
      /* Hide table headers  */

      thead tr {
        display: none;
      }

      tr {
        border: 1px solid #ccc;
      }

      td {
        /* Behave  like a "row" */
        border: none;
        border-bottom: 1px solid #eee;
        position: relative;
      }

      td:before {
        padding-right: 10px;
        white-space: nowrap;

        content: attr(data-label);
        font-size: 14px;

      }
    }
  }

  .alert {
    margin-bottom: 1.3em;
    font-size: 14px;

    &.alert-warning {
      color: hsl(45, 2%, 36%);
      border-color: hsl(41, 83%, 89%);
      background-color: hsl(51, 100%, 96%);
    }

    &.alert-red {
      color: red;
      border-color: red;
      background-color: #fdf3f2;
    }

    ol {
      list-style: none;
      margin-bottom: 0;
      margin-top: 1em;

      li {
        margin-bottom: 0;
      }
    }
  }

  .docs-grid {
    &:after {
      content: " ";
      display: block;
      clear: left;
    }

    .docs-grid-block {
      float: left;
      height: 250px;
      width: 50%;
      border-bottom: 1px solid #eee;
      box-sizing: border-box;
      padding-top: 40px;

      h3 {
        margin-top: 0;

        img {
          float: left;
          margin-right: 15px;
        }
      }

      &:nth-child(odd) {
        padding-right: 25px;
      }

      // &:nth-child(even) {
      //   padding-left: 25px;
      // }

      &:last-of-type {
        height: 200px;
        border-bottom: none;
      }
    }
  }

  .docs-grid-install {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-column-gap: 16px;
    grid-row-gap: 16px;
    max-width: 600px;
    margin: 0 auto;

    .docs-grid-install-block {
      border: 1px solid #9dc6e3;
      border-radius: 4px;
      text-align: center;
      min-height: 120px;
      display: flex;
      flex-direction: column;
      align-items: center;
      -webkit-box-pack: justify;
      -ms-flex-pack: justify;
      justify-content: space-between;
      padding: 16px;
      text-decoration: none;

      .install-icon {
        height: 50px;
        display: -webkit-box;
        display: -ms-flexbox;
        display: flex;
        -webkit-box-pack: center;
        -ms-flex-pack: center;
        justify-content: center;
        -webkit-box-align: center;
        -ms-flex-align: center;
        align-items: center;
      }

      .install-text {
        font-size: 14px;
        line-height: 20px;
        color: rgba(0, 0, 0, .85);
        font-weight: 900;
        transition: .2s ease-in-out;
      }

      &:hover {
        .install-text {
          color: @blue;
        }
      }
    }

    @media (max-width: 1360px) {
      grid-template-columns: 1fr 1fr;
    }

    @media (max-width: 1200px) {
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));;
    }
  }

  .endpoint {
    line-height: 41px;
    margin-bottom: 1em;
    font-size: 14px;
    border-radius: 3px;
    display: block;
    background-color: @gray-light;
    border: 1px solid @gray;

    &:before {
      content: "METHOD";
      background-color: gray;
      display: block;
      color: #fff;
      float: left;
      padding: 1px 15px;
      font-size: 13px;
      font-weight: 600;
      margin: -1px 16px 0 -1px;
      border-radius: 3px 0 0 3px;
    }

    &.get {
      border-color: #9ed99e;

      &:before {
        content: "GET";
        background-color: #3eb33e;
      }
    }

    &.post {
      border-color: #8bc7f2;

      &:before {
        content: "POST";
        background-color: #2391e3;
      }
    }

    &.put {
      border-color: #f2d9a5;

      &:before {
        content: "PUT";
        background-color: #eab03a;
      }
    }

    &.patch {
      border-color: #b59fe0;

      &:before {
        content: "PATCH";
        background-color: #673fb4;
      }
    }

    &.delete {
      border-color: #ec9c9c;

      &:before {
        content: "DELETE";
        background-color: #e23b3b;
      }
    }
  }

  @media (max-width: 1200px) {
    .docs-grid {
      .docs-grid-block {
        width: initial;
        height: auto;

        &:nth-child(odd),
        &:nth-child(even) {
          padding: 1.5em 0;
        }
      }
    }
  }
}

.instructions-steps {
  list-style: none;
  padding-left: 26px;
  counter-reset: step;

  .instructions-step-item {
    position: relative;
    padding: 6px 0 20px 44px;
    border-left: 1px solid @gray;
    margin: 0;

    &:last-child {
      margin-bottom: 0;
      border: 0 none;
    }

    &:before {
      counter-increment: step;
      content: counter(step);
      box-sizing: border-box;
      width: 36px;
      height: 36px;
      line-height: 36px;
      text-align: center;
      border-radius: 50%;
      border: 1px solid @gray;
      background-color: #fff;
      font-weight: 600;
      position: absolute;
      top: 0;
    }
  }
}

.toc {
  border: 1px solid #edf0f2;
  border-radius: 4px;
  background-color: #f9fbfb;
  padding: 18px 25px;
  line-height: 1.3;
}

.alert {
  border: 1px solid @gray;
  border-radius: 4px;
  font-size: 18px;
  padding: 8px 13px;
}

.alert-info {
  color: #757575;
  border-color: #e0e0e0;
  background-color: #f9f9f9;

  &.blue {
    color: #004A80;
    border: none;
    background-color: #EDF7FF;
  }
}

.alert-success {
  color: #3dcc3d;
  border-color: #c0eac0;;
  background-color: #f4fff4;
}

.alert-warning {
  color: #808060;
  border-color: #e0e0c9;;
  background-color: #fffff7;
}

.alert-danger {
  color: #cc3d3d;
  border-color: #eac0c0;;
  background-color: #fff4f4;
}

.alert-ee {
  background-color: #e5f4ff;
  border: none;
  border-left: solid 3px #b3dfff;
  border-radius: 0;

  .alert-body {
    padding-top: 20px;
  }

  .left {
    float: left;
    padding-top: 5px;
    margin: 0 20px 0;
  }

  .tag {
    padding: 2px 8px;
    margin-right: 16px;
    border-radius: 11px;
    font-family: Roboto, -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 10px;
    font-weight: bold;
    background: @blue;
    color: white;

    &.green {
      background: #35cb05;
    }
  }

  img {
    width: 20px;
    margin-right: 5px;
    float: left;
    display: inline-block;
  }

  code {
      font-size: 13px;
    }

  p {
    padding: 0 25px 0 75px;
    font-size: 14px;
  }

  a {
    text-decoration: none;
    color: @blue-light;
  }

  &.condensed {
    padding: 6px 8px;

    .alert-body {
      padding: 0;
      margin: 0;
      display: flex;
      align-items: center;
    }

    p {
      flex-grow: 1;
      padding: 0;
      margin: 0;
    }
  }

  &.margin-bigger {
    margin-bottom: 32px;
  }
}

.breadcrumbs {
  margin: 0;
  padding: 0;
  list-style: none;

  .breadcrumb-item {
    display: inline-block;
    margin: 0;

    &:after {
      content: ' \203a';
    }
  }

  .active a {
    color: @font-color;
    cursor: default;
  }
}

.section {
  padding: 80px 0;

  @media (max-width: 550px) {
    padding: 20px 0;
  }
}

.section-header {
  text-align: center;
  margin-bottom: 45px;

  h2 {
    margin: 0;
    font-size: 34px;
    color: #45494d;
  }

  p {
    font-size: 16px;
    color: #74777a;
    margin: 7px 0 0;
  }
}

.section-buttons {
  margin-top: 20px;
  text-align: center;
}

.subscribe-section {
  background-color: @navy-darker;
  border-top: 1px solid @gray;
  border-bottom: 1px solid #e8e8eb;
  text-align: center;
  padding: 35px 0;

  .newsletter-icon {
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: #fff;
    float: left;
    margin-right: 10px !important;
    background: rgba(255, 255, 255, .2);
    justify-content: center;
    display: flex;
  }

  .newsletter-headline {
    font-size: 19px;
    line-height: 24px;
    font-weight: 400;
    color: #ffffff;
    margin-top: 5px;
  }

  .section-header {
    margin-bottom: 20px;
  }

  .form-message {
    display: none;
    font-size: 16px;
    text-align: center;
    line-height: 24px;
    padding: 9px 0;
  }

  .loader {
    margin: 0 auto;
    padding: 9px 0;
  }

  .message {
    position: absolute;
    top: 40px;
    display: none;
  }

  .success-message {
    color: @green;
    display: block;
  }

  .error-message {
    color: @red;
    display: block;
  }

  h2 {
    text-align: center;
    font-size: 28px;
    margin-bottom: 30px;
  }

  .subscribe-form {
    &:extend(.u-cf);
    margin: 0;
    display: inline-block;
  }

  input,
  .button {
    margin: 0;
    float: left;
  }

  input[type="text"] {
    border-radius: 3px;
    border: 2px solid rgba(0, 0, 0, .1);
    width: 100%;
    height: 40px;
    padding-left: 12px;
    font-size: 16px;

    &.error {
      border-color: @red;
    }
  }

  .button {
    border-radius: 2px;
    padding: 0 19px;
    position: absolute;
    top: 3px;
    right: 3px;
    background-color: @green;
    cursor: pointer;
    height: auto;
    line-height: 32px;
    font-size: 14px;
    color: @white-90;
    letter-spacing: 1px;

    &:hover, &:focus {
      background-color: @green;
      color: @white-90;
    }
  }

  @media screen and (max-width: @grid-width-md) {
    .one-half {
      width: 100%;
      margin-bottom: 15px;
    }

    .newsletter-icon, .hidden-sm-down {
      display: none;
    }
  }
}

// Gitter

.js-gitter-toggle-chat-button {
  z-index: 10000;
  position: fixed;

  bottom: 15px;
  right: 20px;
  width: 48px;
  height: 48px;

  background-color: @blue;
  background-image: url("https://js.intercomcdn.com/images/acquire.png");
  background-position: center;
  background-repeat: no-repeat;
  background-size: 26px 25px;
  box-shadow: 0px 6px 13px 0px rgba(0, 0, 0, 0.23);

  border: 1px solid @navy-dark;
  border-radius: 50%;

  transform: translateX(0vw) translateZ(0) scale(1.0, 1.0);
  transition: background-size 0.3s,
  transform 0.3s cubic-bezier(.16, .22, .22, 1.7),
  opacity 0.3s,
  box-shadow 0.3s;

  &:hover {
    box-shadow: 0px 6px 13px 3px rgba(0, 0, 0, 0.5);
  }

  &.close-gitter {
    background-size: 0 0;
    transform: translateX(-40vw);

    @media (max-width: 1150px) {
      transform: translateX(-55vw);
    }
    @media (max-width: 944px) {
      transform: translateX(-70vw);
    }
    @media (max-width: 600px) {
      transform: translateX(-81vw);
    }
    @media (max-width: 500px) {
      display: none;
    }
  }

  &::before {
    content: 'Chat with Kong Developers';
    display: block;
    position: relative;
    width: 200px;
    top: 9px;
    right: 214px;
    padding: 5px;
    border-radius: 4px 14px 14px 4px;
    background-color: @blue;
    text-align: center;
    color: #fff;
    opacity: 0;

    transition: opacity 0.3s;
  }

  &:hover::before {
    opacity: 1;
  }

  &.close-gitter::before {
    opacity: 0;
  }

  &::after {
    content: '\f00d';
    display: block;
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    font-family: 'FontAwesome';
    font-size: 0;
    text-align: center;
    line-height: 46px;
    color: #fff;

    transition: font-size 0.3s;
  }

  &.close-gitter::after {
    font-size: 40px;
  }
}

// Gitter plugin styles
.gitter-chat-embed {
  z-index: 1002;
}

.gitter-chat-embed-action-bar-item-collapse-chat {
  background-image: url() !important;
}

.gitter-chat-embed-action-bar-item:not(.gitter-chat-embed-action-bar-item-pop-out):active {
  color: #555 !important;
  background: none;
  background-size: 57%;
  background-position: center center;
  background-repeat: no-repeat;
}
